import time
def sort (sp):
    for i in range(len(sp) - 1):
      k = 0
      for j in range (len(sp) - 1 - i):
        if sp[j] > sp[j + 1]:
          t = sp[j]
          sp[j] = sp[j + 1]
          sp[j + 1] = t
          k+=1
      if k == 0:
        break
    return sp
sp = []
op = open("m1_sorted.txt")
for i in op:
  sp.append(int(i))
start = time.time()
sp = sort(sp)
finish = time.time()
print(f'm1.sorted {round((finish-start)*1000)} milliseconds')
sp2 = []
op1 = open("m2_reverse.txt")
for i in op1:
  sp2.append(int(i))
start2 = time.time()
sp = sort(sp2)
finish2 = time.time()
print(f'm2.reverse {round((finish2-start2)*1000)} milliseconds')
sp3 = []
op2 = open("m3_shuffle.txt")
for i in op2:
  sp3.append(int(i))
start3 = time.time()
sp = sort(sp3)
finish3 = time.time()
print(f'm3.shuffle {round((finish3-start3)*1000)} milliseconds')